var _n19;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$zqcc_OverallSystem = require("zqcc_OverallSystem");
var s = cc__importDefault($1$zqcc_OverallSystem);
var $1$Ipha_ComponentBasic = require("Ipha_ComponentBasic");
var c = cc__importDefault($1$Ipha_ComponentBasic);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_Ipha_NumberLabel = function (t) {
  function _ctor() {
    // 创建实例并设置默认属性
    const instance = null !== t && t.apply(this, arguments) || this;

    // 初始化实例属性
    instance.comName = "数字显示文本增加与减少"; // 组件名称
    instance.lbNumber = null; // 数字标签
    instance.unitTime = 1; // 每单位时间
    instance.unitNumber = 1; // 每单位增加的数字
    instance.str = ""; // 显示的字符串
    instance.eventKey = ""; // 事件键
    instance.addedNumber = 0; // 已添加的数字
    instance.timer = 0; // 定时器
    instance.showNumber = 0; // 显示的数字

    return instance; // 返回实例
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () {
    s.default.Canvas().on(this.eventKey, this._event, this);
  };
  _ctor.prototype._event = function (t) {
    // 计算已添加的数字
    this.addedNumber = t - this.showNumber;

    // 更新数字标签
    if (this.str !== null && this.str !== "") {
      // 如果字符串不为空，显示字符串和当前数字
      this.lbNumber.string = `${this.str}: ${t.toFixed(0)}`;
    } else {
      // 否则，只显示当前数字
      this.lbNumber.string = t.toFixed(0);
    }
  };
  _ctor.prototype.start = function () { };
  _ctor.prototype.update = function () {
    this.addedNumber;
  };
  cc__decorate([ccp_property({
    type: cc.Label,
    displayName: "文本"
  })], _ctor.prototype, "lbNumber", undefined);
  cc__decorate([ccp_property({
    displayName: "变动单位时间"
  })], _ctor.prototype, "unitTime", undefined);
  cc__decorate([ccp_property({
    displayName: "变动单位数量"
  })], _ctor.prototype, "unitNumber", undefined);
  cc__decorate([ccp_property({
    displayName: "文本前缀"
  })], _ctor.prototype, "str", undefined);
  cc__decorate([ccp_property({
    displayName: "接收事件key"
  })], _ctor.prototype, "eventKey", undefined);
  return cc__decorate([ccp_ccclass], _ctor);
}(c.default);
exports.default = def_Ipha_NumberLabel;